﻿using HPIT_LiuzuPoint.Business;
using HPIT_LiuzuPoint.Entity.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HPIT_LiuzuPoint.Web.Controllers
{
    public class LogGiftController : Controller
    {
        private LogGiftLevelService _logGiftLevelService = new LogGiftLevelService();
        public ActionResult Index()
        {
            ViewBag.LoggiftList = GetLogGiftLevelList();

            //获取礼品积分下拉框所需的数据源
            return View();
        }

        private List<SelectListItem> GetLogGiftLevelList()
        {
            var logGiftLevelService = _logGiftLevelService.GetList(c => true).Select(c => new SelectListItem()
            {
                Text = c.EL_GiftName,
                Value = c.EL_ID.ToString()
            }).ToList();

            logGiftLevelService.Insert(0, new SelectListItem { Text = "全部", Value = "0" });


            return logGiftLevelService;
        }
        public ActionResult GetPagedGiftList(LogGiftSearchViewModel viewModel)
        {
            var result = _logGiftLevelService.GetPagedGiftList(viewModel);
            return Json(result.Data);
        }
    }
}